package com.salesforce.samples.templateapp;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.RelativeLayout;

import com.salesforce.androidsdk.rest.RestClient;
import com.salesforce.androidsdk.ui.sfnative.SalesforceActivity;

public class MainActivity extends SalesforceActivity {

    RestClient client;
    RelativeLayout rLayout;
    public static MainActivity mActivity;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// Setup view
		setContentView(R.layout.homepage);
		rLayout = (RelativeLayout) findViewById(R.id.rrlayout);
		mActivity = this;
	}
	
	@Override 
	public void onResume() {
		// Hide everything until we are logged in
		rLayout.setVisibility(View.INVISIBLE);

		// Create list adapter
		/*listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new ArrayList<String>());
		((ListView) findViewById(R.id.contacts_list)).setAdapter(listAdapter);	*/			
		
		super.onResume();
	}		
	
	@Override
	public void onResume(RestClient client) {
        // Keeping reference to rest client
        this.client = client; 
        mActivity.client = client;
		// Show everything
        rLayout.setVisibility(View.VISIBLE);
	}

	public void imageAction(View v) {
		startActivity(new Intent(this, TitleActivity.class));
	}
	/**
	 * Called when "Logout" button is clicked. 
	 * 
	 * @param v
	 */
	/*public void onLogoutClick(View v) {
		SalesforceSDKManager.getInstance().logout(this);
	}*/
	
	/**
	 * Called when "Clear" button is clicked. 
	 * 
	 * @param v
	 */
	/*public void onClearClick(View v) {
		listAdapter.clear();
	}*/	

	/**           
	 * Called when "Fetch Contacts" button is clicked
	 * 
	 * @param v
	 * @throws UnsupportedEncodingException 
	 */
	/*public void onFetchContactsClick(View v) throws UnsupportedEncodingException {
        sendRequest("SELECT Name FROM Contact");
	}*/

	/**
	 * Called when "Fetch Accounts" button is clicked
	 * 
	 * @param v
	 * @throws UnsupportedEncodingException 
	 */
	/*public void onFetchAccountsClick(View v) throws UnsupportedEncodingException {
		sendRequest("SELECT Name FROM Account");
	}*/	
	
	
}
